package com.qth.valet.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.qth.valet.common.annotation.Release;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @Release
    @GetMapping("/login/{id}")
    public String login(@PathVariable Integer id) {
        StpUtil.login(id);
        return StpUtil.getTokenValue();
    }

    @GetMapping("/getInfo")
    public Object getInfo() {
        return StpUtil.getTokenInfo();
    }

}
